﻿using eGrid_App;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using ESRI.ArcGIS.Client.Geometry;
using System.Windows.Media;
using Microsoft.Surface.Presentation.Controls;
using System.Windows.Markup;

namespace GISforTT_Test
{
    
    
    /// <summary>
    ///This is a test class for GhostFrameTest and is intended
    ///to contain all GhostFrameTest Unit Tests
    ///</summary>
    [TestClass()]
    public class GhostFrameTest
    {

        private static ArcGisMap backgroundMap;
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        [ClassInitialize()]
        public static void MyClassInitialize(TestContext testContext)
        {
            backgroundMap = new ArcGisMap();

        }
        
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        /// <summary>
        ///A test for GhostFrame Constructor
        ///</summary>
        [TestMethod()]
        public void GhostFrameConstructorTest()
        {
            Envelope mapEnvelope = new Envelope(123.0, 456.0, 78.0, 98.0);
            SolidColorBrush color = new SolidColorBrush(Colors.Red);
            GhostFrame target = new GhostFrame(backgroundMap, mapEnvelope, color);
            //Make sure we have the same color
            Assert.AreEqual(color, target.Color);
            //Make sure the map envelope is the same
            Assert.AreEqual(mapEnvelope, target.Extent);
        }


        /// <summary>
        ///A test for UpdatePosition
        ///</summary>
        [TestMethod()]
        public void UpdatePositionTest()
        {
            Envelope mapEnvelope = new Envelope(123.0, 456.0, 78.0, 91.0);
            SolidColorBrush color = new SolidColorBrush(Colors.Pink);
            GhostFrame target = new GhostFrame(backgroundMap, mapEnvelope, color);
            Envelope newEnvelope = new Envelope(987.0, 654.0, 32.0, 10.0);
            target.UpdatePosition(newEnvelope);
            Assert.AreEqual(newEnvelope.XMax, target.Extent.XMax);
            Assert.AreEqual(newEnvelope.YMax, target.Extent.YMax);
            Assert.AreEqual(newEnvelope.XMin, target.Extent.XMin);
            Assert.AreEqual(newEnvelope.YMin, target.Extent.YMin);
        }

        /// <summary>
        ///A test for Extent
        ///</summary>
        [TestMethod()]
        public void ExtentTest()
        {
            Envelope mapEnvelope = new Envelope(123.0, 456.0, 78.0, 91.0);
            SolidColorBrush color = new SolidColorBrush(Colors.Green);
            GhostFrame target = new GhostFrame(backgroundMap, mapEnvelope, color);
            Envelope actual;
            actual = target.Extent;
            Assert.AreEqual(actual, target.Extent);
        }

    }
}
